<?php
namespace app\yhUtil\type;
use app\yhUtil\YhApi;

class File extends Base {
    protected $contentType = 'file';

    protected $content = [];

    public function __construct(string $file, $message = []){
        parent::__construct($message);
        $this->setFile($file);
    }
    public function setFile(string $file){
        $fileResponse = $this->sendFile($file);
        if($fileResponse['code']){
            $imageKey = $fileResponse['data']['fileKey'];
            return $this->setFikeKey($imageKey);
        }
        throw new $fileResponse['msg'];
    }

    public function setFikeKey($imageKey) {
        $this->content['imageKey'] = $imageKey;
        return $this;
    }
}